
#include <regex.h>

enum {
	TFS_READ = 0,
	TFS_WRITE,
	TFS_GETATTR,
	TFS_OPEN,
	TFS_OPENDIR,
	TFS_READDIR,
	TFS_RELEASEDIR,
	TFS_MKNOD,
	TFS_MKDIR,
	TFS_UNLINK,
	TFS_FGETATTR,
	TFS_ACCESS,
	TFS_READLINK,
	TFS_RMDIR,
	TFS_SYMLINK,
	TFS_RENAME,
	TFS_CHMOD,
	TFS_LINK,
	TFS_CHOWN,
	TFS_TRUNCATE,
	TFS_FTRUNCATE,
	TFS_UTIMENS,
	TFS_CREATE,
	TFS_STATFS,
	TFS_FLUSH,
	TFS_RELEASE,
	TFS_FSYNC,
#ifdef HAVE_SETXATTR
	TFS_SETXATTR,
	TFS_REMOVEXATTR,
	TFS_LISTXATTR,
	TFS_GETXATTR,
#endif /* HAVE_SETXATTR */
#if 0
	TFS_LOCK,
#endif
};

/* #define TFS_OPS_NUM 32 */
#define TFS_OPS_NUM 2

struct TFS_OP {
    size_t limit;
    size_t bytes;
    int match;
    int state;
    struct timeval expiry;
};

struct TFS_POOL {
    char *pool;
    char *proc;
    uid_t uid;
    gid_t gid;

    struct TFS_OP op[TFS_OPS_NUM];

    struct TFS_POOL *next;
};

#define TFS_EXPIRY_SEC(x, y)      x->expiry[y].tv_sec
#define TFS_EXPIRY_USEC(x, y)     x->expiry[y].tv_usec
#define TFS_LIMIT(x, y)           x->limit[y]
#define TFS_RATE(x, y)            x->rate[y]
#define TFS_STATE(x, y)           x->state[y]

struct TFS_POOL * tfs_conf(char * file);

